package cn.itcast.bos.service.transit.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cn.itcast.bos.dao.transit.IDeliveryInfoRepository;
import cn.itcast.bos.dao.transit.ITransitRepository;
import cn.itcast.bos.domain.transit.DeliveryInfo;
import cn.itcast.bos.domain.transit.TransitInfo;
import cn.itcast.bos.service.transit.IDeliveryInfoService;

@Transactional
@Service
public class DeilveryInfoServiceImpl implements IDeliveryInfoService {
	@Autowired
	private IDeliveryInfoRepository deliveryInfoRepository;
	
	@Autowired
	private ITransitRepository transitRepository;
	
	@Override
	public void save(String transitInfoId, DeliveryInfo deliveryInfo) {
		TransitInfo transitInfo = transitRepository.findOne(Integer.valueOf(transitInfoId));
		
		transitInfo.setDeliveryInfo(deliveryInfo);
		transitInfo.setStatus("开始配送");
		
		//保存开始配送信息
		deliveryInfoRepository.save(deliveryInfo);
	}
	
}
